//==============================================================================
//
// Software Development Kit v 3.0
// Shared Types Unit
//
// Copyright (c) 2008-2009 Gear Pair Games
//
// Copyright and license exceptions noted in source
//
// Description: This type(es) unit,
//==============================================================================
unit types;

interface

//standart type override.
type
 // void
 void   = type Pointer;
 pvoid  = ^void;
 // bool
 bool   = type Boolean;
 pbool  = ^bool;
 // char
 char   = type AnsiChar;
 pchar  = type PAnsiChar;
 // byte
 ubyte  = type Byte;
 pubyte = ^ubyte;
 byte   = type ShortInt;
 pbyte  = ^byte;
 // short
 ushort = type Word;
 pushort= ^ushort;
 short  = type SmallInt;
 pshort = ^short;
 // int
 int    = type Integer;
 pint   = ^int;
 uint   = type LongWord;
 puint  = ^uint;
 // float
 float  = type Single;
 pfloat = ^float;
 // new type
 handle = uint;
 dword  = uint;
 enum   = uint;
 penum  = ^enum;
 time   = int64;
 //
// old type set error compile msg
  // invalidformat
 errorInvalidFmtType = ( invalidFmtType );
{.$IFDEF RELEASE}
// set old types ->errorInvalidFormatType
 Shortint = errorInvalidFmtType;
 Boolean  = errorInvalidFmtType;
 Smallint = errorInvalidFmtType;
 Word     = errorInvalidFmtType;
 Integer  = errorInvalidFmtType;
// Cardinal = errorInvalidFmtType;
// LongWord = errorInvalidFmtType;
 Single   = errorInvalidFmtType;
 Pointer  = errorInvalidFmtType;
{.$ENDIF}

 proc     = procedure;
 procObj = procedure of object;
 funcObjBool = function: bool of object;
// procObjOutV =  procedure(const inP: void) of object;
 procObjVarB =  procedure(var inB: bool) of object;
 funcObjOutB =  function: bool of object;
 pfuncObjOutB = ^funcObjOutB;
 funcObjOsHookMsg = function (var inHandle, inMsg: uint; var wparam, lparam: int): int of object;

 vkKeys = (
// keyboard - none
    vkNone,  // none key

// keyboard - down
    vkPlusDwn, vkMinusDwn, vkTildeDwn,
    vk0Dwn, vk1Dwn, vk2Dwn, vk3Dwn, vk4Dwn, vk5Dwn, vk6Dwn, vk7Dwn, vk8Dwn, vk9Dwn,
    vkADwn, vkBDwn, vkCDwn, vkDDwn, vkEDwn, vkFDwn, vkGDwn, vkHDwn, vkIDwn, vkJDwn, vkKDwn, vkLDwn, vkMDwn, vkNDwn, vkODwn, vkPDwn, vkQDwn, vkRDwn, vkSDwn, vkTDwn, vkUDwn, vkVDwn, vkWDwn, vkXDwn, vkYDwn, vkZDwn,
    vkF1Dwn, vkF2Dwn, vkF3Dwn, vkF4Dwn, vkF5Dwn, vkF6Dwn, vkF7Dwn, vkF8Dwn, vkF9Dwn, vkF10Dwn, vkF11Dwn, vkF12Dwn,
    vkEscDwn, vkEnterDwn, vkBackDwn, vkTabDwn, vkShiftDwn, vkCtrlDwn, vkAltDwn, vkSpaceDwn, vkPgupDwn, vkPgdnDwn, vkEndDwn, vkHomeDwn, vkLeftDwn, vkUpDwn, vkRightDwn, vkDownDwn, vkInsDwn, vkDelDwn,
// keyboard - up
    vkPlusUp, vkMinusUp, vkTildeUp,
    vk0Up, vk1Up, vk2Up, vk3Up, vk4Up, vk5Up, vk6Up, vk7Up, vk8Up, vk9Up,
    vkAUp, vkBUp, vkCUp, vkDUp, vkEUp, vkFUp, vkGUp, vkHUp, vkIUp, vkJUp, vkKUp, vkLUp, vkMUp, vkNUp, vkOUp, vkPUp, vkQUp, vkRUp, vkSUp, vkTUp, vkUUp, vkVUp, vkWUp, vkXUp, vkYUp, vkZUp,
    vkF1Up, vkF2Up, vkF3Up, vkF4Up, vkF5Up, vkF6Up, vkF7Up, vkF8Up, vkF9Up, vkF10Up, vkF11Up, vkF12Up,
    vkEscUp, vkEnterUp, vkBackUp, vkTabUp, vkShiftUp, vkCtrlUp, vkAltUp, vkSpaceUp, vkPgupUp, vkPgdnUp, vkEndUp, vkHomeUp, vkLeftUp, vkUpUp, vkRightUp, vkDownUp, vkInsUp, vkDelUp,
// mouse - down
    vkKmLDwn,
    vkKmRDwn,
    vkKmMDwn,
    vkKmWhDwn,
// mouse - up
    vkKmLUp,
    vkKmRUp,
    vkKmMUp,
    vkKmWhUp,
// mouse - dbl
    vkKmLDbl,
    vkKmRDbl,
    vkKmMDbl
           );

 const
 nullInt   = 0;
 nullFloat = 0.0;
 oneInt    = 1;
 oneFloat  = 1.0;
 sizeVoid  = SizeOf( void );
 sizeBool  = SizeOf( bool );
 sizeChar  = SizeOf( char );
 sizeByte  = SizeOf( byte );
 sizeShort = SizeOf( short);
 sizeInt   = SizeOf( int  );
 sizeFloat = SizeOf( float);

 &on       = 1;
 off       = 0;

 implementation
// if only debug mode
{$ifdef debug}
  uses utils;

//layerAssert
procedure layerAssert(const inMsg, inFileName: ansiString; inLineNumb: int; errAddr: void);
begin
 exception( false, inMsg + ' (' + inFileName + ')' + ' line, '+ intStr( inLineNumb ) );
end;

initialization
// init asset porc
  AssertErrorProc:= @layerAssert;
// init report
  ReportMemoryLeaksOnShutdown:= true;
{$endif}
end.
